package com.itheima.sharding.mapper;

import com.itheima.sharding.entity.Incorder;
import com.itheima.sharding.entity.IncorderExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface IncorderMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    long countByExample(IncorderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    int deleteByExample(IncorderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    @Delete({
        "delete from incorder",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    @Insert({
        "insert into incorder (userid)",
        "values (#{userid,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Incorder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    int insertSelective(Incorder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    List<Incorder> selectByExample(IncorderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, userid",
        "from incorder",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("com.itheima.sharding.mapper.IncorderMapper.BaseResultMap")
    Incorder selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") Incorder record, @Param("example") IncorderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") Incorder record, @Param("example") IncorderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(Incorder record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table incorder
     *
     * @mbg.generated
     */
    @Update({
        "update incorder",
        "set userid = #{userid,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Incorder record);
}